package com.minimalist.common.entity.basic.po;

import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;

/**
 * 权限表 实体类。
 *
 * @author 小太阳
 * @since 2024-10-18
 */

@Table(value = "m_perms", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class MPerms extends BaseEntity implements Serializable{

    public MPerms(){
    }

    public MPerms(Long permId, String permCode, String permName, Long parentPermId, Integer permSort, String permPath, String permIcon, String permType, String component, Boolean externalLink, Boolean visible, String remark, Integer status){
        this.permId = permId;
        this.permCode = permCode;
        this.permName = permName;
        this.parentPermId = parentPermId;
        this.permSort = permSort;
        this.permPath = permPath;
        this.permIcon = permIcon;
        this.permType = permType;
        this.component = component;
        this.externalLink = externalLink;
        this.visible = visible;
        this.remark = remark;
        this.status = status;

    }

    public Long getPermId(){
        return permId;
    }

    public void setPermId(Long permId){
        this.permId = permId;
    }

    public String getPermCode(){
        return permCode;
    }

    public void setPermCode(String permCode){
        this.permCode = permCode;
    }

    public String getPermName(){
        return permName;
    }

    public void setPermName(String permName){
        this.permName = permName;
    }

    public Long getParentPermId(){
        return parentPermId;
    }

    public void setParentPermId(Long parentPermId){
        this.parentPermId = parentPermId;
    }

    public Integer getPermSort(){
        return permSort;
    }

    public void setPermSort(Integer permSort){
        this.permSort = permSort;
    }

    public String getPermPath(){
        return permPath;
    }

    public void setPermPath(String permPath){
        this.permPath = permPath;
    }

    public String getPermIcon(){
        return permIcon;
    }

    public void setPermIcon(String permIcon){
        this.permIcon = permIcon;
    }

    public String getPermType(){
        return permType;
    }

    public void setPermType(String permType){
        this.permType = permType;
    }

    public String getComponent(){
        return component;
    }

    public void setComponent(String component){
        this.component = component;
    }

    public Boolean getExternalLink(){
        return externalLink;
    }

    public void setExternalLink(Boolean externalLink){
        this.externalLink = externalLink;
    }

    public Boolean getVisible(){
        return visible;
    }

    public void setVisible(Boolean visible){
        this.visible = visible;
    }

    public String getRemark(){
        return remark;
    }

    public void setRemark(String remark){
        this.remark = remark;
    }

    public Integer getStatus(){
        return status;
    }

    public void setStatus(Integer status){
        this.status = status;
    }



    public static MPermsBuilder builder(){
        return new MPermsBuilder();
    }

    @Override
    public boolean equals(Object o){
        if (this == o){
            return true;
        }
        if (o == null || getClass() != o.getClass()){
            return false;
        }
        if (!super.equals(o)){
            return false;
        }
        MPerms mPerms = (MPerms) o;
        return java.util.Objects.equals(permId, mPerms.permId) &&
                java.util.Objects.equals(permCode, mPerms.permCode) &&
                java.util.Objects.equals(permName, mPerms.permName) &&
                java.util.Objects.equals(parentPermId, mPerms.parentPermId) &&
                java.util.Objects.equals(permSort, mPerms.permSort) &&
                java.util.Objects.equals(permPath, mPerms.permPath) &&
                java.util.Objects.equals(permIcon, mPerms.permIcon) &&
                java.util.Objects.equals(permType, mPerms.permType) &&
                java.util.Objects.equals(component, mPerms.component) &&
                java.util.Objects.equals(externalLink, mPerms.externalLink) &&
                java.util.Objects.equals(visible, mPerms.visible) &&
                java.util.Objects.equals(remark, mPerms.remark) &&
                java.util.Objects.equals(status, mPerms.status);
    }

    @Override
    public int hashCode(){
        return java.util.Objects.hash(super.hashCode(), permId, permCode, permName, parentPermId, permSort, permPath, permIcon, permType, component, externalLink, visible, remark, status);
    }

    public static class MPermsBuilder{
        private Long permId;
        private String permCode;
        private String permName;
        private Long parentPermId;
        private Integer permSort;
        private String permPath;
        private String permIcon;
        private String permType;
        private String component;
        private Boolean externalLink;
        private Boolean visible;
        private String remark;
        private Integer status;


        public MPermsBuilder permId(Long permId){
            this.permId = permId;
            return this;
        }

        public MPermsBuilder permCode(String permCode){
            this.permCode = permCode;
            return this;
        }

        public MPermsBuilder permName(String permName){
            this.permName = permName;
            return this;
        }

        public MPermsBuilder parentPermId(Long parentPermId){
            this.parentPermId = parentPermId;
            return this;
        }

        public MPermsBuilder permSort(Integer permSort){
            this.permSort = permSort;
            return this;
        }

        public MPermsBuilder permPath(String permPath){
            this.permPath = permPath;
            return this;
        }

        public MPermsBuilder permIcon(String permIcon){
            this.permIcon = permIcon;
            return this;
        }

        public MPermsBuilder permType(String permType){
            this.permType = permType;
            return this;
        }

        public MPermsBuilder component(String component){
            this.component = component;
            return this;
        }

        public MPermsBuilder externalLink(Boolean externalLink){
            this.externalLink = externalLink;
            return this;
        }

        public MPermsBuilder visible(Boolean visible){
            this.visible = visible;
            return this;
        }

        public MPermsBuilder remark(String remark){
            this.remark = remark;
            return this;
        }

        public MPermsBuilder status(Integer status){
            this.status = status;
            return this;
        }



        public MPerms build(){
            return new MPerms(permId, permCode, permName, parentPermId, permSort, permPath, permIcon, permType, component, externalLink, visible, remark, status);
        }
    }

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 权限ID
     */
    private Long permId;

    /**
     * 权限标识
     */
    private String permCode;

    /**
     * 权限名称
     */
    private String permName;

    /**
     * 父权限ID
     */
    private Long parentPermId;

    /**
     * 显示顺序
     */
    private Integer permSort;

    /**
     * 路由地址
     */
    private String permPath;

    /**
     * 权限图标 菜单或目录时可传图标
     */
    private String permIcon;

    /**
     * 权限类型  M菜单 B按钮
     */
    private String permType;

    /**
     * 组件路径
     */
    private String component;

    /**
     * 是否为外部链接  0否 1是
     */
    private Boolean externalLink;

    /**
     * 是否可见 0隐藏 1显示）
     */
    private Boolean visible;

    /**
     * 备注
     */
    private String remark;

    /**
     * 状态  0禁用 1正常
     */
    private Integer status;

}
